package com.ruoyi.web.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.web.domain.WorkEnterpriseUser;
import com.ruoyi.web.mapper.WorkEnterpriseUserMapper;
import com.ruoyi.web.service.WorkEnterpriseUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * description:
 * auth fcb
 * date 2025-05-10 11:09
 **/
@Service
@Slf4j
public class WorkEnterpriseUserServiceImpl extends ServiceImpl<WorkEnterpriseUserMapper, WorkEnterpriseUser> implements WorkEnterpriseUserService {


    /**
     * 根据用户Uuid查询绑定的企业
     * @param natureUserUuid 爱山东或统一认证平台用户的uuid
     * @return 绑定的数量
     */
    @Override
    public Integer getEnterpriseUserCount(String natureUserUuid) {
        if(StrUtil.isEmpty(natureUserUuid)) {
            throw new ServiceException("用户Uuid不能为空");
        }
        return this.baseMapper.queryEnterpriseUserCount(natureUserUuid);
    }

    @Override
    public WorkEnterpriseUser getWorkEnterpriseUser(String natureUserUuid) {
        if(StrUtil.isEmpty(natureUserUuid)) {
            throw new ServiceException("用户Uuid不能为空");
        }
        return this.baseMapper.queryWorkEnterpriseUser(natureUserUuid);
    }
}
